package 蓝桥杯;

import java.util.Scanner;

public class score {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int min=arr[0],max=arr[0];
        for (int i = 0; i < n; i++) {
            if(arr[i]>max){
                max=arr[i];
            }
            if(arr[i]<min){
                min=arr[i];
            }
        }
        int count=0;
        for (int i = 0; i < n; i++) {
            count+=arr[i];
        }
        double ave=(count-min-max)/(n-2.0);
        System.out.println(String.format("%.2f",ave));
    }
}
